MSDM5004 Final Project - By Cheng Wing Kit

Probelm C. Image Compression and Denoising

a) Compress the given image file by JPEG with 𝑞⃗ = (1, 1, 1), (1, 10, 10), and (10, 20, 20). Show the compressed images. In each case, count the percentage of Fourier coefficients in each of the three channels that has been discarded (originally non-zero but becomes zero after quantization). Also calculate the average relative difference of each of the three channels in each case. The average relative difference is the absolute value of the ratio of the difference divided by the original value, average over all entries. Comment on your findings.

Original image 4714_0.png

compressed image with 𝑞⃗ = (1,1,1) c1.jpg

compressed image with 𝑞⃗ = (1,10,10) c2.jpg

compressed image with 𝑞⃗ = (10,20,20) c3.jpg

Comment (a): The compressed image using 𝑞⃗ = (1,1,1) does not vary much with the original image. Using 𝑞⃗ = (1,10,10), it is clear that the color of the image become darker due to more information is lost for both Cb and Cr layer. For 𝑞⃗ = (10,20,20), we can see that the image becomes darker and dimmer. Comparing with 𝑞⃗ = (1,10,10), the information lost in Cb and Cr layer is similar but the information in the Y layer was greatly reduced.

b) Redo part (a) but with DFT instead of DCT. Compare and comment on the performance of DFT to DCT.

compressed image with 𝑞⃗ = (1,1,1) c1f.jpg

compressed image with 𝑞⃗ = (1,10,10) c2f.jpg

compressed image with 𝑞⃗ = (10,20,20) c3f.jpg

Comment (b): The compress performance of DCT is better than DFT as the discarded percentage using DCT is higher than DFT under the same 𝑞⃗. It is because the matrix Q was optimized for DCT, information lost using DFT is less as smaller portion of coefficients become 0 after rounding. The result using 𝑞⃗ = (10,20,20) for DCT and DFT are quite different, in which there is no observable darkening effect for DFT. It is because in general the coefficient of 0 frequency obtained from DFT is very large such that the effect of matrix Q made no observable change for small 𝑞⃗.

c) Explain why the algorithm is lossy. In which step(s) is information lost?

Comment (c): Information is lost when rounding is done to the D/Q matrix. The information of frequencies of which the coefficient being rounded to 0 is lost and could be not recovered.

d) A corrupted image of the image in part (a) and (b) is generated by adding random errors to the pixels. Denoise the image using the method described above.

The image is denoised by keeping only the coefficients of the lowest n% frequencies, where n =

$$\begin{bmatrix} 1\% & 1.5\% & 2\% \\ 2.5\% & 3\% & 3.5\% \\ 4\% & 4.5\% & 100\% \end{bmatrix}$$

in the picture below:

Denoise.jpg

e) Explain why the method works.

Comment (e): When the image is transformed into the frequency domain, the random noise tends to spread over the coefficients. So when coefficients of higher frequency vanished, the noise would be reduced. Since most of the information of the original image is stored at low frequencies, the information lost should be less than the noise reduced. The method is thus worked. However, it should be noted that some of the features in the original image would also be removed. The threshold should therefore be carefully selected such that most of the information of the original image could be retained while the remaining noise is acceptable.